Visualize the output of the demonstration
def configure_plotly_browser_state():
import IPython
display(IPython.core.display.HTML('''
<script src="/static/components/requirejs/require.js"></script>
<script>
requirejs.config({
paths: {
base: '/static/base',
plotly: 'https://cdn.plot.ly/plotly-1.5.1.min.js?noext',
},
});
</script>
'''))
import pandas as pd
from scipy import stats
pd.set_option('display.max_colwidth', -1)
import matplotlib.pyplot as plt
import numpy as np
import os
import re
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:95% !important; }</style>"))
%matplotlib inline
from plotly import __version__
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
import plotly.figure_factory as ff
init_notebook_mode(connected=True)
import plotly.graph_objs as go
from plotly.graph_objs import Contours, Histogram2dContour, Marker, Scatter
colors = dict(Conflict = 'rgb(220, 0, 0)',
Colon_cancer_a_c = 'rgb(60, 60, 60)',
Colon_cancer = 'rgb(0, 0, 220)',
Parkinson = 'rgb(0, 220, 0)')
GMT: Tuesday, February 6, 2018 2:50:41 PM
4 possible paths are generated by the demonstration-execution notebook
pd.read_csv('../path/parkinson-answer-t0.csv', sep=',', encoding = 'utf-8')
Path 1 is selected from the 4 paths displayed before
configure_plotly_browser_state()
init_notebook_mode(connected=False)
df_path = pd.read_csv('../path/aggreagatedPath-plot-t0.csv', sep=',', encoding = 'utf-8')
df = [dict(Task=df_path.action_name[0], Start=df_path.start_time[0], Finish=df_path.end_time[0], Resource=df_path.map_name[0])]
i=1
while i < len(df_path):
df.append( dict(Task=df_path.action_name[i], Start=df_path.start_time[i], Finish=df_path.end_time[i], Resource=df_path.map_name[i]) )
i+=1
fig = ff.create_gantt(df, colors=colors, index_col='Resource', show_colorbar=True, title='Path-Parkinson')
fig['layout'].update(autosize=False, width=800, height=600, margin=dict(l=200))
iplot(fig, show_link=False)
GMT: Saturday, April 7, 2018 2:52:21 PM
!eye --nope ../data/data-parkinson-t1-a.ttl ../data/t2.ttl ../parkinson/gps-desc.n3 ../parkinson/score-calculation.n3 ../path/aggreagatedPath-t0.n3 ../engine/gps-plugin-validation.n3 --query ../parkinson/gps-goal-parkinson.n3q
!eye --nope ../data/data-parkinson-t1-b.ttl ../data/t2.ttl ../parkinson/gps-desc.n3 ../parkinson/score-calculation.n3 ../path/aggreagatedPath-t0.n3 ../engine/gps-plugin-validation.n3 --query ../parkinson/gps-goal-parkinson.n3q
GMT: Thursday, April 12, 2018 2:50:33 PM
pd.read_csv('../path/colon-cancer-answer-t3-a.csv', sep=',', encoding = 'utf-8')
pd.read_csv('../path/colon-cancer-answer-t3-b.csv', sep=',', encoding = 'utf-8')
configure_plotly_browser_state()
init_notebook_mode(connected=False)
df_path_a = pd.read_csv('../path/aggreagatedPath-plot-t3-a.csv', sep=',', encoding = 'utf-8')
df_a = [dict(Task=df_path_a.action_name[0], Start=df_path_a.start_time[0], Finish=df_path_a.end_time[0], Resource=df_path_a.map_name[0])]
i=1
while i < len(df_path_a):
df_a.append( dict(Task=df_path_a.action_name[i], Start=df_path_a.start_time[i], Finish=df_path_a.end_time[i], Resource=df_path_a.map_name[i]) )
i+=1
fig_a = ff.create_gantt(df_a, colors=colors, index_col='Resource', show_colorbar=True, title='Path-Parkinson-Colon-Cancer-Scenario-A-with-blocking-colon')
fig_a['layout'].update(autosize=False, width=800, height=600, margin=dict(l=200))
iplot(fig_a, show_link=False)
configure_plotly_browser_state()
init_notebook_mode(connected=False)
df_path_b = pd.read_csv('../path/aggreagatedPath-plot-t3-b.csv', sep=',', encoding = 'utf-8')
df_b = [dict(Task=df_path_b.action_name[0], Start=df_path_b.start_time[0], Finish=df_path_b.end_time[0], Resource=df_path_b.map_name[0])]
i=1
while i < len(df_path_b):
df_b.append( dict(Task=df_path_b.action_name[i], Start=df_path_b.start_time[i], Finish=df_path_b.end_time[i], Resource=df_path_b.map_name[i]) )
i+=1
fig_b = ff.create_gantt(df_b, colors=colors, index_col='Resource', show_colorbar=True, title='Path-Parkinson-Colon-Cancer-Scenario-B-without-blocking-colon')
fig_b['layout'].update(autosize=False, width=800, height=600, margin=dict(l=200))
iplot(fig_b, show_link=False)
configure_plotly_browser_state()
init_notebook_mode(connected=False)
conflict_action_a = pd.read_csv('../path/detected-conflict-t3-a.csv', sep=',', encoding = 'utf-8')
df_a_alert=df_a.copy()
df_a_alert.append( dict(Task=conflict_action_a.action_name[0], Start=conflict_action_a.start_time[0], Finish=conflict_action_a.end_time[0], Resource=conflict_action_a.map_name[0]) )
fig_a_alert = ff.create_gantt(df_a_alert, colors=colors, index_col='Resource', show_colorbar=True, title='Path-Parkinson-Colon-Cancer-Scenario-A-with-blocking-colon')
fig_a_alert['layout'].update(autosize=False, width=800, height=600, margin=dict(l=200))
iplot(fig_a_alert, show_link=False)
configure_plotly_browser_state()
init_notebook_mode(connected=False)
conflict_action_b = pd.read_csv('../path/detected-conflict-t3-b.csv', sep=',', encoding = 'utf-8')
df_b_alert=df_b.copy()
df_b_alert.append( dict(Task=conflict_action_b.action_name[0], Start=conflict_action_b.start_time[0], Finish=conflict_action_b.end_time[0], Resource=conflict_action_b.map_name[0]) )
fig_b_alert = ff.create_gantt(df_b_alert, colors=colors, index_col='Resource', show_colorbar=True, title='Path-Parkinson-Colon-Cancer-Scenario-B-without-blocking-colon')
fig_b_alert['layout'].update(autosize=False, width=800, height=600, margin=dict(l=200))
iplot(fig_b_alert, show_link=False)
configure_plotly_browser_state()
init_notebook_mode(connected=False)
adjuvant_chemoradiotherapy_a = pd.read_csv('../path/path_adjuvant_chemoradiotherapy.csv', sep=',', encoding = 'utf-8')
df_a_details=df_a_alert.copy()
j=0
while j < len(adjuvant_chemoradiotherapy_a):
df_a_details.append( dict(Task=adjuvant_chemoradiotherapy_a.action_name[j], Start=adjuvant_chemoradiotherapy_a.start_time[j], Finish=adjuvant_chemoradiotherapy_a.end_time[j], Resource=adjuvant_chemoradiotherapy_a.map_name[j]) )
j+=1
fig_a_details = ff.create_gantt(df_a_details, colors=colors, index_col='Resource', show_colorbar=True, title='Path-Parkinson-Colon-Cancer-Scenario-A-with-blocking-colon')
fig_a_details['layout'].update(autosize=False, width=800, height=600, margin=dict(l=200))
iplot(fig_a_details, show_link=False)